package main;

import gui.JanelaPDA;

import java.net.MalformedURLException;
import java.rmi.Naming;
import java.rmi.NotBoundException;
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;

import negocios.PDAVirtual;

import com.domus.dreamMenu.comunicacao.InterfaceRemotaServidorPDA;

public class MainPDA {

	private static final String URL_SERVIDOR = "rmi://localhost:5555/Servidor";

	/**
	 * @param args
	 * @throws NotBoundException 
	 * @throws RemoteException 
	 * @throws MalformedURLException 
	 */
	public static void main(String[] args) throws MalformedURLException, RemoteException, NotBoundException {
		InterfaceRemotaServidorPDA servidor = (InterfaceRemotaServidorPDA) Naming.lookup(URL_SERVIDOR);
		JanelaPDA janela = new JanelaPDA();
		PDAVirtual pda = new PDAVirtual(janela);

		LocateRegistry.createRegistry(5332);
		Naming.rebind("rmi://localhost:5332/Pda", pda);
		System.out.println("rodando");
		servidor.registrarPDAVirtual("rmi://localhost:5332/Pda");
		
		janela.setVisible(true);
	}

	
}
